package com.colladaviewer.android.camera;

import android.graphics.Bitmap;
import android.graphics.Canvas;

/**
 * Provides a simple abstraction for obtaining preview captures from a camera
 * on the Android platform. This interface intended to be used temporarily while
 * the Google Android SDK fails to support camera capture from desktop devices
 * (webcams etc).
 * 
 * @author Tom Gibara
 */

public interface CameraSource {

	static final String LOG_TAG = "camera";
	
	/**
	 * Open the camera source for subsequent use via calls to capture().
	 * 
	 * @return true if the camera source was successfully opened.
	 */
	
	boolean open();
	
	/**
	 * Close the camera source. Calling close on a closed CameraSource is
	 * permitted but has no effect. The camera source may be reopened after
	 * being closed.
	 */
	
	void close();
	
	/**
	 * The width of the captured image.
	 * 
	 * @return the width of the capture in pixels
	 */
	
	int getWidth();
	
	/**
	 * The height of the captured image.
	 * 
	 * @return the height of the capture in pixels
	 */
	
	int getHeight();
	
	/**
	 * The last bitmap captured
	 * @return a bitmap from the camera or null
	 */
	Bitmap getLastBitmap();
	
	 /**
     * Returns an exception or null if no error
     * @return
     */
	public Throwable getException();
	
}
